#include "stdafx.h"
#include "problem_solver_core.h"
#include "problem.h"
#include "neuron.h"
#include "input_neuron.h"

namespace nnse
{
	extern io_module io_m;

	// Constructor and Destructor

	template <class T, class U> input_neuron<T, U>::input_neuron(layer<T, U>^ p, unsigned int n_n)
	: neuron(p, n_n)
	{
		io_m.startup_stream << "Constructing input neuron " << get_number() << std::endl;
	}

	template <class T, class U> input_neuron<T, U>::~input_neuron()
	{
		io_m.startup_stream << "Destructing input neuron " << get_number() << std::endl;
	}

	// Worker Functions

	template <class T, class U> U input_neuron<T, U>::reverse(layer<T, U>% dummy_next_layer)
	{
		return 0.0;
	}

	template <class T, class U> U input_neuron<T, U>::calc_NET() 
	{
		get_parent_problem()->put_input_flag();
		return get_parent_problem()->get_value(get_number());
	}

	template <class T, class U> U input_neuron<T, U>::calc_OUT()
	{
		return get_NET();
	}

	// Serialisation Functions

	template <class T, class U> void input_neuron<T, U>::display(std::wofstream& out)
	{
		out << "Input Neuron:" << std::endl;
		neuron<T, U>::display(out);
	}

	// Explicit Instantiation

	template ref class input_neuron<bool, double>;
	template ref class input_neuron<unsigned char, double>;
}
